package app.biz.model;

import com.google.common.base.Strings;
import com.jfinal.kit.JsonKit;

/** Created by gulx@neusoft.com on 2018/12/5. */
public class ClientInfo {

  /*客户端IP：可能为负载均衡器IP*/
  private String ip;

  /*负载均衡器提供的客户端真实IP*/
  private String realIP;

  public String getRealIP() {
    if (!Strings.isNullOrEmpty(realIP)) {
      return realIP;
    }
    return ip;
  }

  public ClientInfo setRealIP(String realIP) {
    this.realIP = realIP;
    return this;
  }

  public String getIP() {
    return ip;
  }

  public ClientInfo setIP(String ip) {
    this.ip = ip;
    return this;
  }

  @Override
  public String toString() {
    return JsonKit.toJson(this);
  }
}
